package cn.edu.lit.jsjxy.CourseExample.chapter5;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import cn.edu.lit.jsjxy.CourseExample.R;

public class ReceiverTestActivity extends Activity
{

    static TextView txt;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_receiver_test);

        txt = (TextView) findViewById(R.id.tvMessage);
        Button btn = (Button) findViewById(R.id.btnSendBoradCast);
        btn.setOnClickListener(new mClick());
    }

    class mClick implements View.OnClickListener
    {
        @Override
        public void onClick(View v)
        {
            Intent intent = new Intent();
            intent.setAction("abc");

            Bundle bundle = new Bundle();
            bundle.putString("hello", "这是广播信息!");

            intent.putExtras(bundle);
            sendBroadcast(intent);
        }
    }
}
